package com.tairanchina.joat.groovy

import com.tairanchina.joat.AnnotationPluginMeta
import com.tairanchina.joat.Plugin
import com.tairanchina.joat.PluginEnvironment
import com.tairanchina.joat.PluginInstallMode
import com.tairanchina.joat.PluginVariable
import com.tairanchina.joat.exception.JoatExecuteException
import com.tairanchina.joat.exception.JoatLifecycleException

/**
 * Created by 周靖捷 on 2016/10/11.
 */
@AnnotationPluginMeta(
        version = "1.0",
        installMode = PluginInstallMode.WATCHER_MODE,
        pluginId = "com.tairanchina.joat.groovy.DemoGroovyPlugin"
)
class DemoGroovyPlugin implements Plugin{
    boolean enabled = true;
    @Override
    Object execute(PluginVariable variable, PluginEnvironment environment) throws JoatExecuteException {
        if (enabled) {
            String helloworlds = variable.get("helloworlds");
            println(helloworlds);
            return helloworlds;
        }
        return null;
    }

    @Override
    void init() throws JoatLifecycleException {

    }

    @Override
    void load() throws JoatLifecycleException {

    }

    @Override
    void run() throws JoatLifecycleException {

    }

    @Override
    void disable() {

    }

    @Override
    void enable() {

    }

    @Override
    void stop() throws JoatLifecycleException {

    }

    @Override
    void destroy() throws JoatLifecycleException {

    }
}
